package main

import "fmt"

type Command interface {
	Execute()
}

type Receiver struct{}

func (r *Receiver) Action() {
	fmt.Println("Receiver: Action")
}

type ConcreteCommand struct {
	receiver *Receiver
}

func (c *ConcreteCommand) Execute() {
	c.receiver.Action()
}

type Invoker struct {
	command Command
}

func (i *Invoker) Invoke() {
	i.command.Execute()
}

func main() {
	receiver := &Receiver{}
	command := &ConcreteCommand{receiver: receiver}
	invoker := &Invoker{command: command}

	invoker.Invoke()
	// Output:
	// Receiver: Action

}
